<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models\Common;

use App\Models\Base;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class ShareBackgroundImg
 *
 * @property int $id
 * @property string $img
 * @property int $sort
 * @property int $version
 * @property Carbon $created_at
 * @property Carbon $updated_at
 *
 * @package App\Models
 */
class ShareBackgroundImg extends Base
{
	protected $table = 'share_background_imgs';

	protected $casts = [
		'sort' => 'int',
		'version' => 'int'
	];

	protected $fillable = [
		'img',
		'sort',
		'version'
	];

	const COMMENT = [
	    'id' => 'ID',
        'img' => '图片',
        'sort' => '排序',
        'version' => '版本',
        'created_at' => '创建时间',
        'updated_at' => '更新时间',
    ];

	protected static function boot()
    {
        parent::boot(); // TODO: Change the autogenerated stub
        static::saving(function($model){
            $model->version +=  1;
            return $model;
        });
    }
}
